import * as api from '.';

const verificationCodeApi = {

  find: async (id: string) => {
    return api.GET('/api/verificationCode/find/:id', { id }, null);
  },

  query: async (mobile: string, usage: string, success: boolean, used: boolean, startDate: string, endDate: string,
    pageNumber: number, pageSize: number) => {
    const data = {
      mobile,
      usage,
      success,
      used,
      startDate,
      endDate,
      pageNumber,
      pageSize
    };
    return api.GET('/api/verificationCode/query', null, data);
  },

  export: async (mobile: string, usage: string | null, success: boolean, used: boolean, startDate: string, endDate: string) => {
    usage = usage ? usage : null;
    const data = {
      mobile,
      usage,
      success,
      used,
      startDate,
      endDate
    };
    return api.downloadData('/api/export/verificationCodes', null, data, '验证码.xlsx');
  },

};

export default verificationCodeApi;
